package br.com.felix.dbm.ui;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import br.com.felix.dbm.ui.components.ImportFromJavaDialog;


public class NotAvailableDialog implements ImportFromJavaDialog{

	private JFrame frame;
	private JPanel panel;
	
	public NotAvailableDialog(){
		frame = new JFrame("Feature unavailable");
		frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		panel = new JPanel();
		panel.setLayout(new GridBagLayout());
		
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.gridx=0;
		gbc.gridy=0;
		panel.add(new JLabel("This feature is not available in the community version."), gbc);
		gbc.gridy=1;
		gbc.insets = new Insets(20,0,0,0);
		JButton okButton = new JButton("Ok");
		okButton.addMouseListener(new MouseAdapter(){
			@Override
			public void mouseReleased(MouseEvent e) {
				frame.dispose();
			}
		});
		panel.add(okButton, gbc);
		frame.getContentPane().add(panel);
		frame.setSize(new Dimension(400,100));
	}
	
	
	@Override
	public void setVisible(boolean b) {
		frame.setVisible(b);
	}

	@Override
	public void toFront() {
		frame.toFront();
	}
}
